<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('操作日志详细')" />
	<th:block th:include="include :: bootstrap-fileinput-css"/>
	<th:block th:include="include :: jsonview-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m-t" id="signupForm" th:object="${sysLeave}">
		<div class="form-group">
			<label class="col-sm-3 control-label">姓名：</label>
			<div class="col-sm-8">
				<input name="name" th:field="*{name}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">部门编号：</label>
			<div class="col-sm-8">
				<input name="deptId" th:field="*{deptId}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">所属组织：</label>
			<div class="col-sm-8">
				<input name="belongOrganization" th:field="*{belongOrganization}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">请假类型：</label>
			<div class="col-sm-8">
				<select name="leaveType" class="form-control m-b" th:with="type=${@dict.getType('sys_leave_type')}">
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">请假开始时间：</label>
			<div class="col-sm-8">
				<div class="input-group date">
					<input name="startTime" th:value="${#dates.format(sysLeave.startTime, 'yyyy-MM-dd HH:mm')}" class="input-sm form-control" id="datetimepicker-startTime" placeholder="yyyy-MM-dd HH:mm" type="text">
					<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">请假结束时间：</label>
			<div class="col-sm-8">
				<div class="input-group date">
					<input name="endTime" th:value="${#dates.format(sysLeave.endTime, 'yyyy-MM-dd HH:mm')}" class="input-sm form-control" id="datetimepicker-endTime" placeholder="yyyy-MM-dd HH:mm" type="text">
					<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">请假长度：</label>
			<div class="col-sm-8">
				<input name="leaveDays" id="leaveDays" th:field="*{leaveDays}" class="form-control" type="text" readonly="readonly">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">请假说明：</label>
			<div class="col-sm-8">
				<input name="leaveDetail" th:field="*{leaveDetail}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">附件地址：</label>
			<div class="col-sm-8">
				<input type="hidden" name="fujianAddress" th:field="*{fujianAddress}">
				<div class="file-loading">
					<input class="form-control file-upload" id="fujianAddress" name="file" type="file">
				</div>
			</div>
		</div>
	</form>
    </div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jsonview-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
	var prefix = ctx + "system/leave";
	$(".file-upload").each(function (i) {
		var val = $("input[name='" + this.id + "']").val()
		console.log("你是个什么东西？"+val)
		$(this).fileinput({
			'uploadUrl': ctx + 'common/upload',
			initialPreviewAsData: true,
			initialPreview: [val],
			maxFileCount: 1,
			autoReplace: true
		}).on('fileuploaded', function (event, data, previewId, index) {
			$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
		}).on('fileremoved', function (event, id, index) {
			$("input[name='" + event.currentTarget.id + "']").val('')
		})
		$(this).fileinput('_initFileActions');
	});
</script>
</body>
</html>